<template>
    <van-row>
        <van-col span="6">

            <van-sidebar v-model="active">
                <van-sidebar-item v-for="item in categoriesApiData" :title="item.cat_name" />
            </van-sidebar>

        </van-col>

        <van-col span="18">
            <div v-for="item in categoriesApiData[active]?.children">
                <h4>{{ item.cat_name }}</h4>
                <router-link :to="'/lb/' + item.cat_name">
                    <van-grid>
                        <van-grid-item v-for="item in item.children" :icon="item.cat_icon" :text="item.cat_name" />
                    </van-grid>
                </router-link>

            </div>

        </van-col>
    </van-row>

</template>

<script setup>
import { categoriesApi } from '@/api/api'
import { ref } from 'vue';
const categoriesApiData = ref([])
categoriesApi().then(res => {
    console.log('分类数据', res);
    categoriesApiData.value = res.data.message
})
const active = ref(0);
</script>

<style lang="scss" scoped></style>